<?php echo $this->element('header');?>

<div id="container_bg">
	<div id="container">
	
		<div id="left_column">
		
			<h2 class="inf_1">Informator dla<br /> mieszkańców</h2>
			<?php if(isset($leftMenu1) && is_array($leftMenu1) && !empty($leftMenu1)) echo $this->Tree->generate($leftMenu1, array('plugin'=>'Menu','model' => 'Menus','element'=>'Menu.leftMenu','class'=>'sf-menu more_elements'));?>
			
			<h2 class="inf_2">Informator dla turystów</h2>
			<?php if(isset($leftMenu2) && is_array($leftMenu2) && !empty($leftMenu2)) echo $this->Tree->generate($leftMenu2, array('plugin'=>'Menu','model' => 'Menus','element'=>'Menu.leftMenu','class'=>'sf-menu more_elements'));?>
			
			<h2 class="gospodarka">Gospodarka</h2>
			<?php if(isset($leftMenu3) && is_array($leftMenu3) && !empty($leftMenu3)) echo $this->Tree->generate($leftMenu3, array('plugin'=>'Menu','model' => 'Menus','element'=>'Menu.leftMenu','class'=>'sf-menu more_elements'));?>
		
		</div>
		
		<div id="center_column">
		
		<h2 class="title">Galeria</h2>
		
			<?php if(isset($gallery_type) && !empty($gallery_type)){?>
			<article>
				<header>
					<h1><?php echo $gallery_type['GalleryCategory']['name']?></h1>
				</header>
				<?php if(isset($galleries_by_type) && !empty($galleries_by_type)){
					foreach ($galleries_by_type as $gallery){?>
					<?php
						if(isset($gallery['Upload']['name']) && !empty($gallery['Upload']['name'])){
							$bg_img = "<span style=\"background: url('{$this->FileUpload->image($gallery['Upload']['name'],array('autoResize'=>true,'imagePathOnly'=>true,'imageNoSpacebar'=>true,'width'=>230))}') no-repeat;\"></span>";
							echo $this->Html->link($bg_img.'<strong>'.h($gallery['Gallery']['name']).'</strong>'.h($gallery['Gallery']['description']),array('plugin'=>false,'controller'=>'galeria','action'=>$gallery['Gallery']['slug']),array('escape'=>false,'title'=>h($gallery['Gallery']['name']),'class'=>'img_bg_lv2'));
						} else {
							echo $this->Html->link($this->Html->image('logo.png',array('alt'=>h($gallery['Gallery']['name']),'title'=>h($gallery['Gallery']['name']))),array('plugin'=>false,'controller'=>'galeria','action'=>$gallery['Gallery']['slug']),array('escape'=>false));
						}
					?>
				<?php }}?>
			</article>
			<?php } else {?>
			
			<?php // WIDOK 2 ?>
			<?php if(isset($default_gallery['Gallery']['name']) && !empty($default_gallery['Gallery']['name'])){
				$gallery_name = $default_gallery['Gallery']['name'];?>
				
				<?php // WIDOK 2.1 ?>
				<article>
					<header>
						<h1><?php echo $gallery_name?></h1>
					</header>
					<?php if(isset($default_gallery) && !empty($default_gallery)){
						foreach ($default_gallery['Upload'] as $gallery){
							if(!empty($gallery['name'])){
								$big_image = $this->FileUpload->image($gallery['name'],array('autoResize'=>true,'imagePathOnly'=>true,'imageNoSpacebar'=>true,'width'=>1024));
								//$flike = $this->element('f.like.image',array('image_path'=>$big_image));
								echo $this->Html->link('',$this->FileUpload->image($gallery['name'],array('autoResize'=>true,'imagePathOnly'=>true,'imageNoSpacebar'=>true,'width'=>1024)),array('escape'=>false,'title'=>h($gallery['description']),'class'=>"highslide",'style'=>"display: block; background: url('{$this->FileUpload->image($gallery['name'],array('autoResize'=>true,'imagePathOnly'=>true,'imageNoSpacebar'=>true,'width'=>150))}') no-repeat center center; width: 150px; height: 110px; float: left; border-radius: 10px; margin: 0 18px 18px 18px;", 'onclick'=>"return hs.expand(this,{slideshowGroup:'gallery-highslide'})"));
					}}}?>
					<div style="padding: 25px 0 0 10px; clear: left;"><?php echo $this->element('socials')?></div>
				</article>
				<?php } else {?>
				<article>
					<header class="hide empty_header">
						<h1><?php echo __('Galerie wg kategorii',true)?></h1>
					</header>
					<?php if(isset($kategorie) && !empty($kategorie)){
						foreach ($kategorie as $gallery){?>
							<?php if(!empty($gallery['Upload']['name'])){
								$bg_img = "<span style=\"background: url('{$this->FileUpload->image($gallery['Upload']['name'],array('autoResize'=>true,'imagePathOnly'=>true,'imageNoSpacebar'=>true,'width'=>230))}') no-repeat;\"></span>";
								echo $this->Html->link($bg_img.h($gallery['GalleryCategory']['name']),array('controller'=>'galerie','action'=>$gallery['GalleryCategory']['slug']),array('escape'=>false,'title'=>h($gallery['Upload']['description']),'class'=>"img_bg"));
							} else {
							echo $this->Html->image('logo.png',array('width'=>200,'alt'=>h($gallery['Gallery']['name']),'title'=>h($gallery['Gallery']['name'])));
							}?>
					<?php }}?>
				</article>
				<?php }?>
			<?php }?>
		
		</div>
		
		<div id="right_column">
		
			<ul>
				<li class="first_gallery"><span class="one_" title="Najnowsze galerie">Najnowsze galerie</span></li>
			</ul>
			
			<!-- NAJNOWSZE GALERIE -->
				<?php if(isset($galleries) && !empty($galleries)){
					foreach ($galleries as $gallery){?>
						<?php if(!empty($gallery['Upload']['name'])){
							$bg_img = "<span style=\"background: url('{$this->FileUpload->image($gallery['Upload']['name'],array('autoResize'=>true,'imagePathOnly'=>true, 'imageNoSpacebar'=>true, 'width'=>180))}') no-repeat center center;\"></span>";
							echo $this->Html->link($bg_img.h($gallery['Gallery']['name']),array('controller'=>'galeria','action'=>$gallery['Gallery']['slug']),array('escape'=>false,'title'=>h($gallery['Gallery']['name']),'class'=>'last_galleries'));
						} else {
							echo $this->Html->image('logo_gora.png',array('width'=>200,'alt'=>h($gallery['Gallery']['name']),'title'=>h($gallery['Gallery']['name'])));
						}?>
				<?php }} ?>
			
			<?php echo $this->element('right_menu');?>
			<?php if(isset($rightMenu) && is_array($rightMenu) && !empty($rightMenu)) echo $this->Tree->generate($rightMenu, array('plugin'=>'Menu','model' => 'Menus','element'=>'Menu.leftMenu'));?>
		
		</div>
	
	</div>
</div>

<?php echo $this->element('footer');?>